import{_ as r}from"./index.vue_vue_type_style_index_0_lang2.js";import{d as t,e as i,r as l,P as d,Q as m,$ as c,K as k,a2 as p,a5 as g,R as n}from"./elementPlusModules.js";const u=n("p",null,"通过设置 columns 属性 params -> searchType 可渲染筛选控件",-1),y=n("p",null,"通过事件 filter-change 监听表格筛选变动",-1),L=t({__name:"Filter",setup(N){const s=i(`
<template>
  <div style="height: 70vh">
    <MerakXTable
      :columns-by-store="JSON.parse(JSON.stringify(state.columns))"
      :columns="state.columns"
      :data="state.data"
      :pagination="false"
      @filter-change="handleFilterChange"
    ></MerakXTable>
  </div>
</template>

<script setup lang="ts">
import { reactive } from "vue";

import MerakXTable, { MerakXTableInstance, MerakXTableColumn } from "../../../../../components/MerakXTable";

const state = reactive<{
  columns: MerakXTableColumn[];
  data: any[];
}>({
  columns: [
    { field: "name", title: "Name", params: { searchType: "input" } },
    { field: "age", title: "Age" },
    { field: "address", title: "Address" }
  ],
  data: [
    {
      id: "1",
      name: "John Brown",
      age: 32,
      address: "New York No. 1 Lake Park",
      description: "My name is John Brown, I am 32 years old, living in New York No. 1 Lake Park."
    },
    {
      id: "2",
      name: "Jim Green",
      age: 42,
      address: "London No. 1 Lake Park",
      description: "My name is Jim Green, I am 42 years old, living in London No. 1 Lake Park."
    },
    {
      id: "3",
      name: "Not Expandable",
      age: 29,
      address: "Jiangsu No. 1 Lake Park",
      description: "This not expandable"
    },
    {
      id: "4",
      name: "Joe Black",
      age: 32,
      address: "Sydney No. 1 Lake Park",
      description: "My name is Joe Black, I am 32 years old, living in Sydney No. 1 Lake Park."
    }
  ]
});

const handleFilterChange: MerakXTableInstance["onFilter-change"] = filters => {
  console.log(filters);
};
<\/script>
`),e=l({columns:[{field:"name",title:"Name",params:{searchType:"input"}},{field:"age",title:"Age"},{field:"address",title:"Address"}],data:[{id:"1",name:"John Brown",age:32,address:"New York No. 1 Lake Park",description:"My name is John Brown, I am 32 years old, living in New York No. 1 Lake Park."},{id:"2",name:"Jim Green",age:42,address:"London No. 1 Lake Park",description:"My name is Jim Green, I am 42 years old, living in London No. 1 Lake Park."},{id:"3",name:"Not Expandable",age:29,address:"Jiangsu No. 1 Lake Park",description:"This not expandable"},{id:"4",name:"Joe Black",age:32,address:"Sydney No. 1 Lake Park",description:"My name is Joe Black, I am 32 years old, living in Sydney No. 1 Lake Park."}]}),o=a=>{console.log(a)};return(a,h)=>(d(),m(g,null,[u,y,c(k(r),{"columns-by-store":JSON.parse(JSON.stringify(e.columns)),columns:e.columns,data:e.data,pagination:!1,onFilterChange:o},null,8,["columns-by-store","columns","data"]),p(a.$slots,"default",{html:s.value})],64))}});export{L as _};
